home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
unix
/
unxfiles.sit
/
source
/
Mac
/
Un*xFiles Dialogs.c
< prev
next >
Wrap
Text File
|
1989-11-22
|
2KB
|
51 lines
/* UnixFiles Dialogs module
* ⌐ 1989 Pete Gontier -- see Un*xFiles_main.c for licensing info
*/
#include "Un*xFiles.h"
#define MBarHeight 0xBAA
void CenterRect ( Rect *r ) {
GrafPtr wmPort;
Rect tempR;
int mbh;
tempR = *r;
mbh = * ( ( unsigned * ) MBarHeight );
GetWMgrPort ( &wmPort );
r->left = ( ( ( wmPort->portRect.right - wmPort->portRect.left) / 2 ) -
( tempR.right - tempR.left ) / 2 );
r->top = ( mbh / 2 ) +
( ( ( wmPort->portRect.bottom - wmPort->portRect.top ) / 2 ) -
( ( tempR.bottom - tempR.top ) / 2 ) );
r->right = ( ( tempR.right - tempR.left ) / 2 ) +
( ( wmPort->portRect.right - wmPort->portRect.left ) / 2 );
r->bottom = ( mbh / 2 ) +
( ( tempR.bottom - tempR.top ) / 2 ) +
( ( wmPort->portRect.bottom - wmPort->portRect.top ) / 2 );
}
Point SFCenter ( int resID ) {
Rect tempR;
DialogTHndl h = GetResource('DLOG', resID);
tempR = ( ( DialogTPtr ) *h )->boundsRect;
CenterRect ( & tempR );
return ( topLeft ( tempR ) );
}
int myAlert ( int theID, FilterProc dialogFilter ) {
AlertTHndl h = GetResource('ALRT', theID);
CenterRect ( & ( ( ( AlertTPtr ) *h )->boundsRect ) );
SetCursor ( &arrow );
return ( Alert ( theID, dialogFilter ) );
}
DialogPtr myGetNewDialog ( int resID, Ptr dStorage, WindowPtr behind ) {
DialogTHndl h = GetResource('DLOG', resID);
CenterRect ( & ( ( ( DialogTPtr ) *h )->boundsRect ) );
SetCursor ( &arrow );
return ( GetNewDialog ( resID, ( DialogPeek ) dStorage, behind ) );
}